#include "CDirectRenderer.h"
#include "CSprite.h"

#include <SDL.h>

void CDirectRenderer::Redraw()
{
	SDL_Flip(Screen);

    // clear screen;
    SDL_FillRect(Screen, 0, 0);

}

void CDirectRenderer::DrawSprite(SpriteType t, size_t x, size_t y)
{
	SDL_Surface* sprite = SpriteManager->Get(t)->GetSurface();
	SDL_Rect src = SpriteManager->Get(t)->GetRect();

	SDL_Rect dest;
	dest.x = TopLeftCornerMapX  + x + src.x;
	dest.y = TopLeftCornerMapY + y + src.y;
	dest.w = src.w;
	dest.h = src.h;

	SDL_BlitSurface(sprite, &src, Screen, &dest);
}

